Report post

How to add an array to another array?

A simple method to add an array to another array is to select the second array, loop through all the elements, and append each element to the first array. However, this particular solution is rather long and inefficient for larger arrays. Output: hair extension scissors hair cream hair fryer makeup set true

How do I create a new array from a variable?

You could either, store the array into variables and create a new array from both : Or build it using the operator. EDIT With your new addition, you were very close. What you need is to use the operator on the $goal array. This operator adds another element to an array. In our case, we want to add $person, since it's the newly created row.

How to print all array elements using array_push method?

Use for each loop to print all the array elements. Output: Using array_push Method: This method pushes the second array element in the first array in-place. Example: // arr2 elements are being pushed in the arr1. // Use for each loop to print all the array elements. echo $value . ' '; Output:

The World's Leading Crypto Trading Platform

Get my welcome gifts